//
// CRayMesh.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------
package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;

public class CRayMesh {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CRayMesh(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CRayMesh obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CRayMesh(swigCPtr);
      }
      swigCPtr = 0;
    }
  }
/*
  public static boolean getRayIntersection(Vector_CVector vertices, Vector_uint16 tris, SWIGTYPE_p_float dist2D, SWIGTYPE_p_float distZ, boolean computeDist2D) {
    return nel3dJNI.CRayMesh_getRayIntersection__SWIG_0(Vector_CVector.getCPtr(vertices), vertices, Vector_uint16.getCPtr(tris), tris, SWIGTYPE_p_float.getCPtr(dist2D), SWIGTYPE_p_float.getCPtr(distZ), computeDist2D);
  }*/

  public static boolean getRayIntersection(Vector_CVector vertices, Vector_uint16 tris, SWIGTYPE_p_float dist2D, SWIGTYPE_p_float distZ, boolean computeDist2D) {
    return nel3dJNI.CRayMesh_getRayIntersection__SWIG_1(Vector_CVector.getCPtr(vertices), vertices, Vector_uint16.getCPtr(tris), tris, SWIGTYPE_p_float.getCPtr(dist2D), SWIGTYPE_p_float.getCPtr(distZ), computeDist2D);
  }

  public void setVertices(Vector_CVector value) {
    nel3dJNI.CRayMesh_Vertices_set(swigCPtr, this, Vector_CVector.getCPtr(value), value);
  }

  public Vector_CVector getVertices() {
    long cPtr = nel3dJNI.CRayMesh_Vertices_get(swigCPtr, this);
    return (cPtr == 0) ? null : new Vector_CVector(cPtr, false);
  }

  public void setTriangles(Vector_uint16 value) {
    nel3dJNI.CRayMesh_Triangles_set(swigCPtr, this, Vector_uint16.getCPtr(value), value);
  }

  public Vector_uint16 getTriangles() {
    long cPtr = nel3dJNI.CRayMesh_Triangles_get(swigCPtr, this);
    return (cPtr == 0) ? null : new Vector_uint16(cPtr, false);
  }

  public boolean empty() {
    return nel3dJNI.CRayMesh_empty(swigCPtr, this);
  }

  public void clear() {
    nel3dJNI.CRayMesh_clear(swigCPtr, this);
  }

  public boolean fastIntersect(SWIGTYPE_p_NLMISC__CMatrix worldMatrix, CVector p0, CVector dir, SWIGTYPE_p_float dist2D, SWIGTYPE_p_float distZ, boolean computeDist2D) {
    return nel3dJNI.CRayMesh_fastIntersect(swigCPtr, this, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(worldMatrix), CVector.getCPtr(p0), p0, CVector.getCPtr(dir), dir, SWIGTYPE_p_float.getCPtr(dist2D), SWIGTYPE_p_float.getCPtr(distZ), computeDist2D);
  }

  public CRayMesh() {
    this(nel3dJNI.new_CRayMesh(), true);
  }

}
